package 贪心;

import java.util.Arrays;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
@author mubei
@date  2021/12/22
@description    
*/public class Demo01 {

    public static void main(String[] args) {

    }

    public String PrintMinNumber(int [] numbers) {

        IntStream stream = Arrays.stream(numbers);
//流中的元素全部装箱，转换为流 ---->int转为Integer
        Stream<Integer> integerStream = stream.boxed();
//将流转换为数组
        Integer[] integers = integerStream.toArray(Integer[]::new);
        Arrays.sort(integers,(a,b)->{
            String as = a+""+b;
            String bs = b+""+a;
            return as.compareTo(bs);
        });
        StringBuffer sb = new StringBuffer();
        for (Integer integer : integers) {
            sb.append(integer);
        }
        return sb.toString();
    }

}
